<template>
  <div class="footer">
    <div class="footer-btn">
      <img src="@/assets/images/kefu.png" alt="" />
      <span>客服</span>
    </div>
    <div class="footer-btn" @click="goCart">
      <img src="@/assets/images/gouwuche.png" alt="" />
      <span>购物车</span>
    </div>
    <div class="footer-btn">
      <img src="@/assets/images/shoucang.png" alt="" />
      <span>收藏</span>
    </div>
    <div class="footer-big-btn footer-add-btn" @click="addCart">加入购物车</div>
    <div class="footer-big-btn footer-buy-btn">立即购买</div>
  </div>
</template>

<script>
import { Toast } from "mint-ui";

export default {
  name: "Footer",
  props: ["id"],
  methods: {
    async addCart() {
      let res = await this.$http.addCart({ goods_id: this.id, qty: 1 });
      if (res.code == 200) {
        Toast("加入购物车成功");
      }
    },
    goCart(){
      this.$router.push('/cart')
    }
  },
};
</script>

<style lang="scss" scoped>
.footer {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1.3067rem;
  z-index: 999;
  background-color: #fff;
  border-top: 1px solid #e5e5e5;
  display: flex;
  justify-content: space-between;
  align-items: center;

  &-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;

    img {
      width: 45%;
    }
    span {
      font-size: 0.3733rem;
    }
  }

  &-big-btn {
    font-size: 0.4267rem;
    color: #fff;
    width: 120px;
    height: 1.3067rem;
    line-height: 1.3067rem;
    text-align: center;
  }
  &-add-btn {
    background-color: #ff9500;
  }
  &-buy-btn {
    background-color: #dd2727;
  }
}
</style>